package com.lzh.service;

import com.lzh.info.OrderInfo;
import com.lzh.repository.OrderRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 订单的服务
 */
@Service
public class OrderService {

    @Autowired
    OrderRepository orderRepository;

    //生成订单
    public int createOrder(OrderInfo orderInfo){

        //与数据库交互要用order模块自己的实体类
        com.lzh.repository.info.OrderInfo o = new com.lzh.repository.info.OrderInfo();

        o.setNumber(orderInfo.getNumber());

        return orderRepository.save(o).getId();
    }
}
